<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>New Page</title>
	<script src="<?=base_url();?>js/jquery.js" type="text/javascript" /></script>

</head>
<script type="text/javascript">
<!--
	$(document).ready(function() {
		$("#submit1").click(function (){
			var post_data = $("#name").val()+"&"+$("#content").val();
			alert(post_data)
			$.ajax({
			   type: "POST",
			   url: "<?=base_url();?>chat/insert",
			   data: post_data,
			   success: function(msg){
				 alert( "Data Saved: " + msg );
			   }
			});
		})
	});
//-->
</script>
<body>
<div id="pageContent">
<?php
foreach($chat_data as $chat):
?>
<table>
	<tr>
		<td>&nbsp;</td>
		<td><?=$chat->id?></td>
		<td><?=$chat->name?></td>
		<td><?=$chat->content?></td>
	</tr>
</table>
<?php endforeach;?>

    <h1>chat Box</h1>
    <hr />

	<div id="echoText">11<br />22</div>

	<form action="<?=base_url();?>chat/insert" name="mainform" id="mainform" method="post">

	<input type="hidden" name="name1" value="nobody" />
        <label>Enter your favorite Word or Phrase:</label>
        <input type="text" name="name" id="name" size="20" value="" /><br /><br />
		<label>Enter your favorite Word or Phrase:</label>
		<textarea id="content" name="content" rows="10" cols="30"></textarea>
		<br />
        <input type="button" name="submit1" id="submit1" value="Submit" />
    </form>
</div>
</body>
</html>